Skip to content

Use bounded exponentiation to improve encrypt/verify performance#662

Merged
tarcieri merged 1 commit intoRustCrypto:masterfrom
lubux:feat/improve-encrypt-performance
Feb 26, 2026
Merged

Use bounded exponentiation to improve encrypt/verify performance#662
tarcieri merged 1 commit intoRustCrypto:masterfrom
lubux:feat/improve-encrypt-performance

Conversation

@lubux
Copy link
Contributor

@lubux lubux commented Feb 25, 2026

Limit exponentiation to the bit length of e to reduce computation time.
This is safe since e is public.

Improves encrypt/verify performance by over 2x on my laptop.

rsa_2048_pkcsv1_encrypt time:   [17.822 µs 17.849 µs 17.877 µs]
                        change: [-80.899% -80.786% -80.697%] (p = 0.00 < 0.05)
                        Performance has improved.
rsa_4096_pkcsv1_encrypt time:   [149.74 µs 150.04 µs 150.37 µs]
                        change: [-63.132% -61.496% -60.140%] (p = 0.00 < 0.05)
                        Performance has improved.
                        
                        
aws_lc_rs_2048_pkcs1_encrypt
                        time:   [10.682 µs 10.714 µs 10.747 µs]
aws_lc_rs_4096_pkcs1_encrypt
                        time:   [31.771 µs 31.826 µs 31.879 µs]

Limit exponentiation to the bit length of e to reduce computation time.
This is safe since e is public.
@tarcieri tarcieri merged commit ae65734 into RustCrypto:master Feb 26, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants